//
//  ItemCell.swift
//  SwiftOfXiaoShouJia
//
//  Created by zhenjingxiong on 2018/8/31.
//  Copyright © 2018年 镇景雄. All rights reserved.
//

import UIKit
import SnapKit

class ItemCell: UITableViewCell {
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.layoutUI()
    }
    
    func layoutUI()  {
        //左边的图片
        self.addSubview(self.leftImageView)
        self.leftImageView.snp.makeConstraints { (make) in
            make.left.equalTo(10)
            make.centerY.equalTo(self)
        }
        //底下的一根线
        self.addSubview(self.horizontalLineImageView)
        self.horizontalLineImageView.snp.makeConstraints { (make) in
            make.left.equalTo(10)
            make.bottom.right.equalTo(self)
            make.height.equalTo(0.5)
        }
        //文字描述
        self.addSubview(self.titleLable)
        self.titleLable.snp.makeConstraints { (make) in
            make.left.equalTo(self.leftImageView.snp.right).offset(10)
            make.centerY.equalTo(self)
        }
        //最右边的箭头
        self.addSubview(self.rightArrowImageView)
        self.rightArrowImageView.snp.makeConstraints { (make) in
            make.right.equalTo(self.snp.right).offset(-10)
            make.centerY.equalTo(self)
        }
        //待完善的数量
        self.addSubview(self.rightLabel)
        self.rightLabel.snp.makeConstraints { (make) in
            make.right.equalTo(self.rightArrowImageView.snp.right).offset(-20)
            make.centerY.equalTo(self)
        }
        
    }
    
    lazy var titleLable = { () -> UILabel in
        let lable = UILabel.init()
        lable.text = "除了帅,一无所有"
        lable.font = UIFont.systemFont(ofSize: 14)
        return lable
    }()
    
    lazy var leftImageView: UIImageView = {
        let leftImageView = UIImageView.init(image: UIImage.init(named: "icon_toBe"))
        return leftImageView
    }()
    
    lazy var horizontalLineImageView: UIImageView = {
        let horizontalLineImageView = UIImageView.init()
        horizontalLineImageView.backgroundColor = UIColor.gray
        return horizontalLineImageView
    }()
    
    lazy var rightArrowImageView: UIImageView = {
        let rightArrowImageView = UIImageView.init(image: UIImage.init(named: "icon_arrow"))
        return rightArrowImageView
    }()
    
    lazy var rightLabel: UILabel = {
        let rightLabel = UILabel.init()
        rightLabel.text = "0"
        rightLabel.textColor = UIColor.gray
        return rightLabel
    }()
    
   
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}

